{include file="buy/header.tpl"}

<body id="buy-main-body" style="overflow-y: hidden;">
<div style="overflow: hidden; width: 100%; height: 42px;"><!-- 头部// -->
{include file="buy/top.tpl"}</div>
<!-- start: Content -->
<div id="content" class="" style="padding: 0px; top: 0px;">
<div class="row-fluid">
<div id="buy-main-body-con" class="box" style="margin: 0px;"><!-- Default panel contents -->
<div class="pull-left float: left;"
	style="width: 16%; margin-left: 5px; height: 100%; overflow-y: scroll; background: #fff;">
<ul class="nav nav-tabs nav-stacked">
	{foreach from=$rs.category item=l}
	<li onclick="setUrl('./index.php?buy/goods/?cid={$l.id}',this)"><a
		href="javascript:void(0)">{$l.category}</a></li>
	{/foreach}
</ul>
</div>
<div class="" style="width: 83%; float: right; height: 100%;">

<div class="" style="margin-right: 2%;line-height: 40px; width: 98%; overflow: hidden;">

 <a href="./index.php?buy/iframe" class="badge badge-important">帮</a> 客服电话:0573-82696190 
 <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=1901900888&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:1901900888:41" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>
  
<div class="input-append" style="display:inline-block;">
<input type="text" name="title" id="goods_name" placeholder="输入产品名称" class="input-large" >
<button type="button" class="btn btn-warning" onclick="search()"><i
	class="icon-search"></i></button>
</div>

<a href="javascript:setUrl('./index.php?buy/flag/?remark=特价',this)" class="badge badge-important">特价</a>

 <a href="javascript:setUrl('./index.php?buy/hot',this)" class="badge badge-important">销量榜</a>
 
 <span>加入购物车后可在购物车中更改件数</span>
<a href="javascript:setUrl('./index.php?buy/cart',this)" id="cart"
	class="btn btn-danger" style="float: right;margin-top: 10px;"><i
	class="icon-shopping-cart"></i> 查看购物车</a></div>
<iframe src="./index.php?buy/center" id="iframe" width="100%"></iframe>
</div>
</div>
</div>
</div>
<div style="display: none">
<form action="./index.php?buy/cart" method="get" id="form"><input
	type="text" name="goodsinfo" id="goodsinfo"></form>
</div>
</body>
  <script src="./static/public/jquery-1.11.0.min.js"></script>
  <script src="./static/public/jqueryui/jquery-ui.js"></script>
<script type="text/javascript"
	src="./static/public/jsorder/js/cookie.js"></script>
<script type="text/javascript"
	src="./static/public/jsorder/js/jsorder.js"></script>
	 <script  type="text/javascript" src="./static/public/layer/layer.min.js" ></script>
	
{literal}
<script type="text/javascript"> 
	var winWidth = 0; 
	var winHeight = 0;  
	function findDimensions() //函数：获取尺寸 
	{  
		//获取窗口宽度  
		if (window.innerWidth)
			winWidth = window.innerWidth;  
			else if ((document.body) && (document.body.clientWidth)) 
			winWidth = document.body.clientWidth; 
			//获取窗口高度  
		if (window.innerHeight)  
			winHeight = window.innerHeight;  
		else if ((document.body) && (document.body.clientHeight)) 
			winHeight = document.body.clientHeight;  
			//通过深入Document内部对body进行检测，获取窗口大小  
  if (document.documentElement  && document.documentElement.clientHeight && document.documentElement.clientWidth) 
  {
	winHeight = document.documentElement.clientHeight; 
	winWidth = document.documentElement.clientWidth; 
	}  
	//结果输出到指定ID
	document.getElementById("buy-main-body").style.width= winWidth+"px";//赋值宽度值
	document.getElementById("buy-main-body").style.height= winHeight+"px"; //赋值高度值
	document.getElementById("buy-main-body-con").style.height= winHeight-44+"px"; //赋值高度值
	document.getElementById("iframe").style.height= winHeight-74+"px"; //赋值高度值
  }  
  findDimensions(); 
  //调用函数，获取数值  
  window.onresize=findDimensions;  
  </script>
<script type='text/javascript'>
function setUrl(url,obj){
	$("li").each(function(){
		$(this).removeClass("active");
		})
	$(obj).addClass("active");
	$("#iframe").attr("src",url);	
}

$(function() {
	 
    $( "#goods_name" ).autocomplete({
      source: "./index.php?buy/api/?",
      minLength: 1,
      select: function( event, ui ) {

    	  $("#iframe").attr("src", "./index.php?buy/search/?title="+this.value);
      }
    });
  });

//jsorder配置
$.fn.jsorder.defaults = {
	staticname : 'jsorder',
	jsorderclass : 'jsorder',
	savecookie : true,
	cookiename : 'buy',
	numpre : 'no_',
	jsorderpre : 'jsorder_',
	jsorderspanpre : 'jsorderspan_',
	pricefiled : 'price',
	namefiled : 'jsordername',
	leftdemo : '购物车',
	subbuttom : '', 
	//addbuttom : 'a.jsorderadd', 
	addbuttom : 'a.jsorderadd', 
	nomessage : '你今天的包裹是还空的',
	dosubmit : function(data) {
}
};
$("body").jsorder();

$(document).ready(function(){
	  $("input[name='title']").keyup(function(event){
          if(event.which==13){
               search();
          }
		  })

	})


function search(){
	 var value=$("input[name='title']").val();
     if(value.length<1){
    layer.alert("搜索内容不能为空哦",8);
  
      }else{
 		 $("#iframe").attr("src", "./index.php?buy/search/?title="+value);

          }
	 
	}

</script>
{/literal} 

{include file="news/footer.tpl"}
